using System;
using System.ComponentModel;
using System.Threading;
using FU.Capstones.IMS.Web.Common.InventoryServiceProxy.DataContracts;
using FU.Capstones.IMS.Web.Common.InventoryServiceProxy.EventArgs;
using FU.Capstones.IMS.Web.Common.InventoryServiceProxy.Interfaces;
using FU.Capstones.IMS.Web.Common.InventoryServiceProxy.Respondents;

namespace FU.Capstones.IMS.Web.Common.InventoryServiceProxy.OperationContracts
{
    public partial class InventoryServiceClient
    {

        #region GetMaterialCollection

        public event EventHandler<CollectionFeedbackCompletedEventArgs<Material>> GetMaterialCollectionCompleted;

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        IAsyncResult IInventoryService.BeginGetMaterialCollection(bool isShowAll, AsyncCallback callback, object asyncState)
        {
            return Channel.BeginGetMaterialCollection(isShowAll, callback, asyncState);
        }

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        CollectionFeedback<Material> IInventoryService.EndGetMaterialCollection(IAsyncResult result)
        {
            return Channel.EndGetMaterialCollection(result);
        }

        private IAsyncResult OnBeginGetMaterialCollection(object[] inValues, AsyncCallback callback, object asyncState)
        {
            bool isShowAll = (bool)inValues[0];

            return ((IInventoryService)(this)).BeginGetMaterialCollection(isShowAll, callback, asyncState);
        }

        private object[] OnEndGetMaterialCollection(IAsyncResult result)
        {
            CollectionFeedback<Material> retVal = ((IInventoryService)(this)).EndGetMaterialCollection(result);
            return new object[] { retVal };
        }

        private void OnGetMaterialCollectionCompleted(object state)
        {
            if ((GetMaterialCollectionCompleted != null))
            {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                GetMaterialCollectionCompleted(this, new CollectionFeedbackCompletedEventArgs<Material>(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }

        public void GetMaterialCollectionAsync(bool isShowAll)
        {
            GetMaterialCollectionAsync(isShowAll, null);
        }

        public void GetMaterialCollectionAsync(bool isShowAll, object userState)
        {
            if ((onBeginGetMaterialCollectionDelegate == null))
            {
                onBeginGetMaterialCollectionDelegate = new BeginOperationDelegate(OnBeginGetMaterialCollection);
            }
            if ((onEndGetMaterialCollectionDelegate == null))
            {
                onEndGetMaterialCollectionDelegate = new EndOperationDelegate(OnEndGetMaterialCollection);
            }
            if ((onGetMaterialCollectionCompletedDelegate == null))
            {
                onGetMaterialCollectionCompletedDelegate = new SendOrPostCallback(OnGetMaterialCollectionCompleted);
            }
            InvokeAsync(onBeginGetMaterialCollectionDelegate, new object[] {
                    isShowAll}, onEndGetMaterialCollectionDelegate, onGetMaterialCollectionCompletedDelegate, userState);
        }

        private BeginOperationDelegate onBeginGetMaterialCollectionDelegate;

        private EndOperationDelegate onEndGetMaterialCollectionDelegate;

        private SendOrPostCallback onGetMaterialCollectionCompletedDelegate;

        private partial class InventoryServiceClientChannel
        {
            public IAsyncResult BeginGetMaterialCollection(bool isShowAll, AsyncCallback callback, object asyncState)
            {
                object[] _args = new object[1];
                _args[0] = isShowAll;

                IAsyncResult _result = BeginInvoke("GetMaterialCollection", _args, callback, asyncState);
                return _result;
            }

            public CollectionFeedback<Material> EndGetMaterialCollection(IAsyncResult result)
            {
                object[] _args = new object[0];
                CollectionFeedback<Material> _result = ((CollectionFeedback<Material>)(EndInvoke("GetMaterialCollection", _args, result)));
                return _result;
            }
        }

        #endregion

        #region GetMaterialCollectionType

        public event EventHandler<CollectionFeedbackCompletedEventArgs<Material>> GetMaterialCollectionTypeCompleted;

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        IAsyncResult IInventoryService.BeginGetMaterialCollectionType(bool isShowAll, AsyncCallback callback, object asyncState)
        {
            return Channel.BeginGetMaterialCollectionType(isShowAll, callback, asyncState);
        }

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        CollectionFeedback<Material> IInventoryService.EndGetMaterialCollectionType(IAsyncResult result)
        {
            return Channel.EndGetMaterialCollectionType(result);
        }

        private IAsyncResult OnBeginGetMaterialCollectionType(object[] inValues, AsyncCallback callback, object asyncState)
        {
            bool isShowAll = (bool)inValues[0];

            return ((IInventoryService)(this)).BeginGetMaterialCollectionType(isShowAll, callback, asyncState);
        }

        private object[] OnEndGetMaterialCollectionType(IAsyncResult result)
        {
            CollectionFeedback<Material> retVal = ((IInventoryService)(this)).EndGetMaterialCollectionType(result);
            return new object[] { retVal };
        }

        private void OnGetMaterialCollectionTypeCompleted(object state)
        {
            if ((GetMaterialCollectionTypeCompleted != null))
            {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                GetMaterialCollectionTypeCompleted(this, new CollectionFeedbackCompletedEventArgs<Material>(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }

        public void GetMaterialCollectionTypeAsync(bool isShowAll)
        {
            GetMaterialCollectionTypeAsync(isShowAll, null);
        }

        public void GetMaterialCollectionTypeAsync(bool isShowAll, object userState)
        {
            if ((onBeginGetMaterialCollectionTypeDelegate == null))
            {
                onBeginGetMaterialCollectionTypeDelegate = new BeginOperationDelegate(OnBeginGetMaterialCollectionType);
            }
            if ((onEndGetMaterialCollectionTypeDelegate == null))
            {
                onEndGetMaterialCollectionTypeDelegate = new EndOperationDelegate(OnEndGetMaterialCollectionType);
            }
            if ((onGetMaterialCollectionTypeCompletedDelegate == null))
            {
                onGetMaterialCollectionTypeCompletedDelegate = new SendOrPostCallback(OnGetMaterialCollectionTypeCompleted);
            }
            InvokeAsync(onBeginGetMaterialCollectionTypeDelegate, new object[] {
                    isShowAll}, onEndGetMaterialCollectionTypeDelegate, onGetMaterialCollectionTypeCompletedDelegate, userState);
        }

        private BeginOperationDelegate onBeginGetMaterialCollectionTypeDelegate;

        private EndOperationDelegate onEndGetMaterialCollectionTypeDelegate;

        private SendOrPostCallback onGetMaterialCollectionTypeCompletedDelegate;

        private partial class InventoryServiceClientChannel
        {
            public IAsyncResult BeginGetMaterialCollectionType(bool isShowAll, AsyncCallback callback, object asyncState)
            {
                object[] _args = new object[1];
                _args[0] = isShowAll;

                IAsyncResult _result = BeginInvoke("GetMaterialCollectionType", _args, callback, asyncState);
                return _result;
            }

            public CollectionFeedback<Material> EndGetMaterialCollectionType(IAsyncResult result)
            {
                object[] _args = new object[0];
                CollectionFeedback<Material> _result = ((CollectionFeedback<Material>)(EndInvoke("GetMaterialCollectionType", _args, result)));
                return _result;
            }
        }

        #endregion
        
        #region GetSingleMaterial

        public event EventHandler<SingleFeedbackCompletedEventArgs<Material>> GetSingleMaterialCompleted;

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        IAsyncResult IInventoryService.BeginGetSingleMaterial(int materialID, AsyncCallback callback, object asyncState)
        {
            return Channel.BeginGetSingleMaterial(materialID, callback, asyncState);
        }

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        SingleFeedback<Material> IInventoryService.EndGetSingleMaterial(IAsyncResult result)
        {
            return Channel.EndGetSingleMaterial(result);
        }

        private IAsyncResult OnBeginGetSingleMaterial(object[] inValues, AsyncCallback callback, object asyncState)
        {
            int materialID = (int)inValues[0];

            return ((IInventoryService)(this)).BeginGetSingleMaterial(materialID, callback, asyncState);
        }

        private object[] OnEndGetSingleMaterial(IAsyncResult result)
        {
            SingleFeedback<Material> retVal = ((IInventoryService)(this)).EndGetSingleMaterial(result);
            return new object[] { retVal };
        }

        private void OnGetSingleMaterialCompleted(object state)
        {
            if ((GetSingleMaterialCompleted != null))
            {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                GetSingleMaterialCompleted(this, new SingleFeedbackCompletedEventArgs<Material>(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }

        public void GetSingleMaterialAsync(int materialID)
        {
            GetSingleMaterialAsync(materialID, null);
        }

        public void GetSingleMaterialAsync(int materialID, object userState)
        {
            if ((onBeginGetSingleMaterialDelegate == null))
            {
                onBeginGetSingleMaterialDelegate = new BeginOperationDelegate(OnBeginGetSingleMaterial);
            }
            if ((onEndGetSingleMaterialDelegate == null))
            {
                onEndGetSingleMaterialDelegate = new EndOperationDelegate(OnEndGetSingleMaterial);
            }
            if ((onGetSingleMaterialCompletedDelegate == null))
            {
                onGetSingleMaterialCompletedDelegate = new SendOrPostCallback(OnGetSingleMaterialCompleted);
            }
            InvokeAsync(onBeginGetSingleMaterialDelegate, new object[] {
                                                                                   materialID}, onEndGetSingleMaterialDelegate, onGetSingleMaterialCompletedDelegate, userState);
        }

        private BeginOperationDelegate onBeginGetSingleMaterialDelegate;

        private EndOperationDelegate onEndGetSingleMaterialDelegate;

        private SendOrPostCallback onGetSingleMaterialCompletedDelegate;

        private partial class InventoryServiceClientChannel
        {
            public IAsyncResult BeginGetSingleMaterial(int materialID, AsyncCallback callback, object asyncState)
            {
                object[] _args = new object[1];
                _args[0] = materialID;

                IAsyncResult _result = BeginInvoke("GetSingleMaterial", _args, callback, asyncState);
                return _result;
            }

            public SingleFeedback<Material> EndGetSingleMaterial(IAsyncResult result)
            {
                object[] _args = new object[0];
                SingleFeedback<Material> _result = ((SingleFeedback<Material>)(EndInvoke("GetSingleMaterial", _args, result)));
                return _result;
            }
        }

        #endregion

        #region InsertMaterial

        public event EventHandler<SingleFeedbackCompletedEventArgs<int>> InsertMaterialCompleted;

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        IAsyncResult IInventoryService.BeginInsertMaterial(Material data, AsyncCallback callback, object asyncState)
        {
            return Channel.BeginInsertMaterial(data, callback, asyncState);
        }

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        SingleFeedback<int> IInventoryService.EndInsertMaterial(IAsyncResult result)
        {
            return Channel.EndInsertMaterial(result);
        }

        private IAsyncResult OnBeginInsertMaterial(object[] inValues, AsyncCallback callback, object asyncState)
        {
            Material data = (Material)inValues[0];

            return ((IInventoryService)(this)).BeginInsertMaterial(data, callback, asyncState);
        }

        private object[] OnEndInsertMaterial(IAsyncResult result)
        {
            SingleFeedback<int> retVal = ((IInventoryService)(this)).EndInsertMaterial(result);
            return new object[] { retVal };
        }

        private void OnInsertMaterialCompleted(object state)
        {
            if ((InsertMaterialCompleted != null))
            {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                InsertMaterialCompleted(this, new SingleFeedbackCompletedEventArgs<int>(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }

        public void InsertMaterialAsync(Material data)
        {
            InsertMaterialAsync(data, null);
        }

        public void InsertMaterialAsync(Material data, object userState)
        {
            if ((onBeginInsertMaterialDelegate == null))
            {
                onBeginInsertMaterialDelegate = new BeginOperationDelegate(OnBeginInsertMaterial);
            }
            if ((onEndInsertMaterialDelegate == null))
            {
                onEndInsertMaterialDelegate = new EndOperationDelegate(OnEndInsertMaterial);
            }
            if ((onInsertMaterialCompletedDelegate == null))
            {
                onInsertMaterialCompletedDelegate = new SendOrPostCallback(OnInsertMaterialCompleted);
            }
            InvokeAsync(onBeginInsertMaterialDelegate, new object[] {
                                                                                data}, onEndInsertMaterialDelegate, onInsertMaterialCompletedDelegate, userState);
        }

        private BeginOperationDelegate onBeginInsertMaterialDelegate;

        private EndOperationDelegate onEndInsertMaterialDelegate;

        private SendOrPostCallback onInsertMaterialCompletedDelegate;

        private partial class InventoryServiceClientChannel
        {
            public IAsyncResult BeginInsertMaterial(Material data, AsyncCallback callback, object asyncState)
            {
                object[] _args = new object[1];
                _args[0] = data;

                IAsyncResult _result = BeginInvoke("InsertMaterial", _args, callback, asyncState);
                return _result;
            }

            public SingleFeedback<int> EndInsertMaterial(IAsyncResult result)
            {
                object[] _args = new object[0];
                SingleFeedback<int> _result = ((SingleFeedback<int>)(EndInvoke("InsertMaterial", _args, result)));
                return _result;
            }
        }

        #endregion

        #region UpdateMaterial

        public event EventHandler<FeedbackCompletedEventArgs> UpdateMaterialCompleted;

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        IAsyncResult IInventoryService.BeginUpdateMaterial(Material data, AsyncCallback callback, object asyncState)
        {
            return Channel.BeginUpdateMaterial(data, callback, asyncState);
        }

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        Feedback IInventoryService.EndUpdateMaterial(IAsyncResult result)
        {
            return Channel.EndUpdateMaterial(result);
        }

        private IAsyncResult OnBeginUpdateMaterial(object[] inValues, AsyncCallback callback, object asyncState)
        {
            Material data = (Material)inValues[0];

            return ((IInventoryService)(this)).BeginUpdateMaterial(data, callback, asyncState);
        }

        private object[] OnEndUpdateMaterial(IAsyncResult result)
        {
            Feedback retVal = ((IInventoryService)(this)).EndUpdateMaterial(result);
            return new object[] { retVal };
        }

        private void OnUpdateMaterialCompleted(object state)
        {
            if ((UpdateMaterialCompleted != null))
            {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                UpdateMaterialCompleted(this, new FeedbackCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }

        public void UpdateMaterialAsync(Material data)
        {
            UpdateMaterialAsync(data, null);
        }

        public void UpdateMaterialAsync(Material data, object userState)
        {
            if ((onBeginUpdateMaterialDelegate == null))
            {
                onBeginUpdateMaterialDelegate = new BeginOperationDelegate(OnBeginUpdateMaterial);
            }
            if ((onEndUpdateMaterialDelegate == null))
            {
                onEndUpdateMaterialDelegate = new EndOperationDelegate(OnEndUpdateMaterial);
            }
            if ((onUpdateMaterialCompletedDelegate == null))
            {
                onUpdateMaterialCompletedDelegate = new SendOrPostCallback(OnUpdateMaterialCompleted);
            }
            InvokeAsync(onBeginUpdateMaterialDelegate, new object[] {
                                                                                data}, onEndUpdateMaterialDelegate, onUpdateMaterialCompletedDelegate, userState);
        }

        private BeginOperationDelegate onBeginUpdateMaterialDelegate;

        private EndOperationDelegate onEndUpdateMaterialDelegate;

        private SendOrPostCallback onUpdateMaterialCompletedDelegate;

        private partial class InventoryServiceClientChannel
        {
            public IAsyncResult BeginUpdateMaterial(Material data, AsyncCallback callback, object asyncState)
            {
                object[] _args = new object[1];
                _args[0] = data;

                IAsyncResult _result = BeginInvoke("UpdateMaterial", _args, callback, asyncState);
                return _result;
            }

            public Feedback EndUpdateMaterial(IAsyncResult result)
            {
                object[] _args = new object[0];
                Feedback _result = ((Feedback)(EndInvoke("UpdateMaterial", _args, result)));
                return _result;
            }
        }

        #endregion

        #region DeleteMaterial

        public event EventHandler<FeedbackCompletedEventArgs> DeleteMaterialCompleted;

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        IAsyncResult IInventoryService.BeginDeleteMaterial(int data, AsyncCallback callback, object asyncState)
        {
            return Channel.BeginDeleteMaterial(data, callback, asyncState);
        }

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        Feedback IInventoryService.EndDeleteMaterial(IAsyncResult result)
        {
            return Channel.EndDeleteMaterial(result);
        }

        private IAsyncResult OnBeginDeleteMaterial(object[] inValues, AsyncCallback callback, object asyncState)
        {
            int data = (int)inValues[0];

            return ((IInventoryService)(this)).BeginDeleteMaterial(data, callback, asyncState);
        }

        private object[] OnEndDeleteMaterial(IAsyncResult result)
        {
            Feedback retVal = ((IInventoryService)(this)).EndDeleteMaterial(result);
            return new object[] { retVal };
        }

        private void OnDeleteMaterialCompleted(object state)
        {
            if ((DeleteMaterialCompleted != null))
            {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                DeleteMaterialCompleted(this, new FeedbackCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }

        public void DeleteMaterialAsync(int data)
        {
            DeleteMaterialAsync(data, null);
        }

        public void DeleteMaterialAsync(int data, object userState)
        {
            if ((onBeginDeleteMaterialDelegate == null))
            {
                onBeginDeleteMaterialDelegate = new BeginOperationDelegate(OnBeginDeleteMaterial);
            }
            if ((onEndDeleteMaterialDelegate == null))
            {
                onEndDeleteMaterialDelegate = new EndOperationDelegate(OnEndDeleteMaterial);
            }
            if ((onDeleteMaterialCompletedDelegate == null))
            {
                onDeleteMaterialCompletedDelegate = new SendOrPostCallback(OnDeleteMaterialCompleted);
            }
            InvokeAsync(onBeginDeleteMaterialDelegate, new object[] {
                                                                                data}, onEndDeleteMaterialDelegate, onDeleteMaterialCompletedDelegate, userState);
        }

        private BeginOperationDelegate onBeginDeleteMaterialDelegate;

        private EndOperationDelegate onEndDeleteMaterialDelegate;

        private SendOrPostCallback onDeleteMaterialCompletedDelegate;

        private partial class InventoryServiceClientChannel
        {
            public IAsyncResult BeginDeleteMaterial(int data, AsyncCallback callback, object asyncState)
            {
                object[] _args = new object[1];
                _args[0] = data;

                IAsyncResult _result = BeginInvoke("DeleteMaterial", _args, callback, asyncState);
                return _result;
            }

            public Feedback EndDeleteMaterial(IAsyncResult result)
            {
                object[] _args = new object[0];
                Feedback _result = ((Feedback)(EndInvoke("DeleteMaterial", _args, result)));
                return _result;
            }
        }

        #endregion

        #region SearchMaterial

        public event EventHandler<CollectionFeedbackCompletedEventArgs<Material>> SearchMaterialCompleted;

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        IAsyncResult IInventoryService.BeginSearchMaterial(MaterialCriteria criteria, AsyncCallback callback, object asyncState)
        {
            return Channel.BeginSearchMaterial(criteria, callback, asyncState);
        }

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        CollectionFeedback<Material> IInventoryService.EndSearchMaterial(IAsyncResult result)
        {
            return Channel.EndSearchMaterial(result);
        }

        private IAsyncResult OnBeginSearchMaterial(object[] inValues, AsyncCallback callback, object asyncState)
        {
            MaterialCriteria criteria = (MaterialCriteria)inValues[0];

            return ((IInventoryService)(this)).BeginSearchMaterial(criteria, callback, asyncState);
        }

        private object[] OnEndSearchMaterial(IAsyncResult result)
        {
            CollectionFeedback<Material> retVal = ((IInventoryService)(this)).EndSearchMaterial(result);
            return new object[] { retVal };
        }

        private void OnSearchMaterialCompleted(object state)
        {
            if ((SearchMaterialCompleted != null))
            {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                SearchMaterialCompleted(this, new CollectionFeedbackCompletedEventArgs<Material>(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }

        public void SearchMaterialAsync(MaterialCriteria criteria)
        {
            SearchMaterialAsync(criteria, null);
        }

        public void SearchMaterialAsync(MaterialCriteria criteria, object userState)
        {
            if ((onBeginSearchMaterialDelegate == null))
            {
                onBeginSearchMaterialDelegate = new BeginOperationDelegate(OnBeginSearchMaterial);
            }
            if ((onEndSearchMaterialDelegate == null))
            {
                onEndSearchMaterialDelegate = new EndOperationDelegate(OnEndSearchMaterial);
            }
            if ((onSearchMaterialCompletedDelegate == null))
            {
                onSearchMaterialCompletedDelegate = new SendOrPostCallback(OnSearchMaterialCompleted);
            }
            InvokeAsync(onBeginSearchMaterialDelegate, new object[] {
                                                                                criteria}, onEndSearchMaterialDelegate, onSearchMaterialCompletedDelegate, userState);
        }

        private BeginOperationDelegate onBeginSearchMaterialDelegate;

        private EndOperationDelegate onEndSearchMaterialDelegate;

        private SendOrPostCallback onSearchMaterialCompletedDelegate;

        private partial class InventoryServiceClientChannel
        {
            public IAsyncResult BeginSearchMaterial(MaterialCriteria criteria, AsyncCallback callback, object asyncState)
            {
                object[] _args = new object[1];
                _args[0] = criteria;

                IAsyncResult _result = BeginInvoke("SearchMaterial", _args, callback, asyncState);
                return _result;
            }

            public CollectionFeedback<Material> EndSearchMaterial(IAsyncResult result)
            {
                object[] _args = new object[0];
                CollectionFeedback<Material> _result = ((CollectionFeedback<Material>)(EndInvoke("SearchMaterial", _args, result)));
                return _result;
            }
        }

        #endregion

        #region UndoDeleteMaterial

        public event EventHandler<FeedbackCompletedEventArgs> UndoDeleteMaterialCompleted;

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        IAsyncResult IInventoryService.BeginUndoDeleteMaterial(int objID, AsyncCallback callback, object asyncState)
        {
            return Channel.BeginUndoDeleteMaterial(objID, callback, asyncState);
        }

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        Feedback IInventoryService.EndUndoDeleteMaterial(IAsyncResult result)
        {
            return Channel.EndUndoDeleteMaterial(result);
        }

        private IAsyncResult OnBeginUndoDeleteMaterial(object[] inValues, AsyncCallback callback, object asyncState)
        {
            int objID = (int)inValues[0];

            return ((IInventoryService)(this)).BeginUndoDeleteMaterial(objID, callback, asyncState);
        }

        private object[] OnEndUndoDeleteMaterial(IAsyncResult result)
        {
            Feedback retVal = ((IInventoryService)(this)).EndUndoDeleteMaterial(result);
            return new object[] { retVal };
        }

        private void OnUndoDeleteMaterialCompleted(object state)
        {
            if ((UndoDeleteMaterialCompleted != null))
            {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                UndoDeleteMaterialCompleted(this, new FeedbackCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }

        public void UndoDeleteMaterialAsync(int objID)
        {
            UndoDeleteMaterialAsync(objID, null);
        }

        public void UndoDeleteMaterialAsync(int objID, object userState)
        {
            if ((onBeginUndoDeleteMaterialDelegate == null))
            {
                onBeginUndoDeleteMaterialDelegate = new BeginOperationDelegate(OnBeginUndoDeleteMaterial);
            }
            if ((onEndUndoDeleteMaterialDelegate == null))
            {
                onEndUndoDeleteMaterialDelegate = new EndOperationDelegate(OnEndUndoDeleteMaterial);
            }
            if ((onUndoDeleteMaterialCompletedDelegate == null))
            {
                onUndoDeleteMaterialCompletedDelegate = new SendOrPostCallback(OnUndoDeleteMaterialCompleted);
            }
            InvokeAsync(onBeginUndoDeleteMaterialDelegate, new object[] {
                    objID}, onEndUndoDeleteMaterialDelegate, onUndoDeleteMaterialCompletedDelegate, userState);
        }

        private BeginOperationDelegate onBeginUndoDeleteMaterialDelegate;

        private EndOperationDelegate onEndUndoDeleteMaterialDelegate;

        private SendOrPostCallback onUndoDeleteMaterialCompletedDelegate;

        private partial class InventoryServiceClientChannel
        {
            public IAsyncResult BeginUndoDeleteMaterial(int objID, AsyncCallback callback, object asyncState)
            {
                object[] _args = new object[1];
                _args[0] = objID;

                IAsyncResult _result = BeginInvoke("UndoDeleteMaterial", _args, callback, asyncState);
                return _result;
            }

            public Feedback EndUndoDeleteMaterial(IAsyncResult result)
            {
                object[] _args = new object[0];
                Feedback _result = ((Feedback)(EndInvoke("UndoDeleteMaterial", _args, result)));
                return _result;
            }
        }

        #endregion
        

    }
}